package com.ita.servlet.action;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ita.dao.GoodsDao;
import com.ita.dao.impl.GoodsDaoImpl;

/**
 * Servlet implementation class DelelteServlet
 */
public class DelelteServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private GoodsDao goodsDao;

	public DelelteServlet() {
		goodsDao = new GoodsDaoImpl();
	}

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		String id = request.getParameter("id");
		String wid =request.getParameter("wid");
		goodsDao.deleteGoods(id);
		response.sendRedirect("show?wid=" + wid);

	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
